package com.csun.cmny.provider.service.impl;

import com.csun.cmny.core.support.BaseService;
import com.csun.cmny.provider.mapper.OpcFlowMessageWayMapper;
import com.csun.cmny.provider.model.domain.OpcFlowMessageWay;
import com.csun.cmny.provider.model.vo.message.MessageWayVo;
import com.csun.cmny.provider.service.OpcFlowMessageWayService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.List;

/**
 * @Auther: chisj chisj@foxmal.com
 * @Date: 2019-11-07 11:07
 * @Description:
 */
@Service
@Transactional
public class OpcFlowMessageWayServiceImpl extends BaseService<OpcFlowMessageWay> implements OpcFlowMessageWayService {

    @Resource
    private OpcFlowMessageWayMapper opcFlowMessageWayMapper;

    /**
     * 给推送消息模板指定推送方式
     *
     * @param opcFlowMessageWay the opc flow message way
     * @return the int.
     */
    @Override
    public Integer bind(OpcFlowMessageWay opcFlowMessageWay) {

        return opcFlowMessageWayMapper.insertSelective(opcFlowMessageWay);
    }

    /**
     * 给推送消息模板删除推送方式
     *
     * @param opcFlowMessageWay the opc flow message way
     * @return the int.
     */
    @Override
    public Integer untied(OpcFlowMessageWay opcFlowMessageWay) {

        return opcFlowMessageWayMapper.delete(opcFlowMessageWay);
    }

    /**
     * 查询消息推送方式列表
     *
     * @param id 消息模板Id
     *
     * @return the message way vo
     */
    @Override
    public List<MessageWayVo> queryWayListById(Long id) {

        return opcFlowMessageWayMapper.queryWayListById(id);
    }
}
